Repository navigation
A description names the head it was built for and is rebuilt whenever the head differs - #665
Merged
Merged
Conversation
… the head differs A dependency run's description was built on the commit that changed the manifest, where the lockfile still resolved the old version. The lockfile was regenerated in later commits and the run completed with a description that still said "not moved on the head", still counted the advisory as not fixed and still listed items of the earlier head. - description: a hidden stamp names the head the description was built for. reconcile rebuilds it when the stamp is not the pull request's head: after every message in which CoderHelm moved the branch, in the checks and settle step, before a review of its own pull request, in the pull request watch and at the end of the run, which returns an error instead of completing on another head's description. - GitHub client: every request leaves through send_tracked, which notes the branch a successful ref update, contents write or merge moved. No caller has to remember to ask for a rebuild. - review: its open findings are written on the description as it is now and only while the reviewed head is still the head. It used to write back the copy it read when it started. - settle: an item that says a lockfile is out of sync is checked on the head by the repository's checks, never carried as CoderHelm's own. - own review: a finding that the description is behind the code triggers the rebuild and is dropped when the rebuild settles it. Every finding that is not pure style is CoderHelm's to act on. - dep_head: tests for suffixed versions, exact-version override keys and a package moved on a later head. - Incident case ar and its row in docs/incidents.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The first live dependency run after #658 showed that a description built from the head does not stay true. A feedback round changed an override in the manifest and the description was rebuilt on that commit, where the lockfile still resolved the old version. The lockfile was regenerated in the commits after it, the checks ran again and the run completed. The description still said "not moved on the head", still counted the advisory as not fixed, and still listed the package under open findings and "the lockfile is out of sync" under Open items. CoderHelm's own review of the final head saw it and left it as a note.
Root causes, from reading the code against the run's timeline (the run's logs were not available to me):
services/worker/src/passes/mod.rs, the checks step for a pull request that is already open (let pr_result = if let Some(o) = opened, thenpr::apply_checksaftersettle::run). It skipspr::runand only patches CoderHelm's owned sections. It never rebuilt the sections computed from the lockfile, andwith_checksinpr.rscopied the old open findings forward as they were.services/worker/src/passes/review_pr.rs, where a review of CoderHelm's own pull request writes its open findings. It added its section to the copy of the description read when the review started and saved that. A review that began before a rebuild and ended after it put the earlier description back, and a review of a head already replaced wrote that head's findings onto the new one. Four reviews on four different heads ran in the minute after the feedback round.lock_repair_on_prinresume.rsand its callers push a regenerated lockfile and nothing rebuilt the description after it.settle::classifytreated an item about the lockfile as CoderHelm's own work left, so no check ever settled it.own_review::requiredleft out every optional finding, so a wording note about the description ended the loop.dep_headread the versions correctly: the new tests with suffixed versions and an override keyed on the exact version pass without a change to it.This change makes the rebuild independent of which code path pushed.
Changes
A stamp, and one rebuild that every resting point calls
description.rs: the description carries<!-- coderhelm:built-for <sha> -->.reconcilereads the pull request, and when the stamp is not its head it rebuilds everything computed from the branch and stamps the head.rebuilddoes the same whatever the stamp says (CI ended on the same head, the model rewrote the prose).security_fixes::at_headis the one builder of the dependency sections anddescription.rsis its only caller (a test holds that).main::handle_message, after every message, for each branch CoderHelm moved while handling it (reconcile_moved);pr::apply_checks, so the checks and settle step ends on a description of its head, including after a redrive;pr::run, so the first description is stamped;review_pr, before a review of CoderHelm's own pull request reads the description;pr_watch::perform;resume::complete_run_with_status: when the description cannot be rebuilt for the head the step returns an error and is tried again. A run does not complete while stamp and head differ.Every push is seen in one place
clients/github.rs: all requests leave throughsend_tracked. It now notes the branch moved by a successful ref update or creation, contents write or delete, or merge (branch_moved_by). The branches are drained byreconcile_moved.send_tracked, when a write is built and not sent through it, or when a pass calls GitHub's refs or merges endpoints itself.Nothing of an earlier head survives
review_pr.rs: open findings are written withdescription::edit, which reads the description as it is now, applies the one section and saves. It writes nothing when the reviewed head is no longer the pull request's head.settle.rs: an item that says a lockfile is out of sync is classified as something CoderHelm runs (Action::LockSync). The repository's checks install from the lockfile; when they ran and passed on this head the item closes with that result, otherwise it stays and says what was or was not run.CoderHelm's review of its own pull request
own_review::about_description: a finding that names the description and says it is behind the code. It is never optional. The review callsdescription::rebuildfor it before deciding what is open; when the rebuild changed the description the finding is dropped, otherwise it is required and goes to a fix round, whose end rewrites the description.own_review::requirednow leaves out only pure style (review_severity::pure_style: a preference the reviewer inferred, such as wording, naming or layout). An optional improvement to working code is required. The existing round limits apply (own_review::MAX_FIX_ROUNDS, then the findings are deferred with the reason).review_severity::optionalhad no other caller and is removed.Tests and the incident suite
dep_head: versions with a suffix on and off their line, an exact-version override key read from pnpm, npm and yarn lockfile text, and a package moved on a later head after an earlier head recorded it as not moved.incidents/ar_description_stamped_to_the_head.rsand its row indocs/incidents.md.Not in this change
reconcileonly stamps. Its prose is still rewritten by the model in the paths that callhead_moved.LockSyncrests on the repository's checks installing from the lockfile. A repository whose check command installs without a frozen lockfile would close the item on a passing check without proving it.pnpmcommands.review_fix/suite.rsandsuite_shell.rsnever callensure_manager, which is what makes pnpm or yarn available in the other sandbox commands, so apnpmcommand there runs on an image without pnpm.Verification
cargo fmt --check --all: cleancargo clippy --workspace --all-targets -- -D warnings: cleancargo test --workspace: passes on the tree merged with main (common 2295, gateway 912, worker 1785, 0 failed)dep_headcases above.